<?php 
$yearstr=$str->getafteryear();
?> 
<div class="right_side_operate_area">
	<div class="right_side_title left">
    	<h2>
    		<?php echo $form->value('Techstack.name'); ?>
    	</h2>
    </div>
    <div class="right back_btn">
	    <?php 
	    	echo $html->link("返回","",array("onclick"=>"history.go(-1);return false;"));
	    ?>
    </div>
    <div class="right item_add_btn">
    	 <?php 
    	if($id){
    		echo $html->link(__("Delete",true),"/searchs/delfilter/".$id."/".$filtertype, array("onclick"=>"return doaction(this)"));
    		echo $this->element('actionconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？"));
    	}
    	?>
   	</div>
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
    	<?php echo $form -> create('searchs', array('url' => '/searchs/'.$this->action.'/','type'=> 'post','onsubmit'=>'return checksave()') ); ?>
		<div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">名称：</div>
                <div class="form_right_e_input left">
                	<?php echo $form->text('Techstack.name',array("maxlength"=>"100","onkeypress"=>"TextValidate()"));?>
                </div>
                <div id='namemessage' style='display:none;' class="error_message">请输入名称</div>
                <div id='pname' style='display:none;'><?php echo $form->value('Techstack.name')?></div>
            </div>
        </div>
 	    <div class="details_item_line">
	   	   <div class="details_item">
		     	<div class="form_left_title left">备注：</div>
		    	<div class="form_right_e_input left">
		    		<?php echo $form->textarea('Techstack.desc',array("maxlength"=>""));?>
		    	</div>
    		</div>
    	</div>
    	<div class="line"></div>
         <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">注册时间：</div>
                <div class="form_right_e_input form_date_picker left">
		    	<?php echo $form->text('Techstack.reg_mintime',array("maxlength"=>"10","style"=>"width:80px",
               "onfocus"=>"startf()"));?>
                	到
               <?php echo $form->text('Techstack.reg_maxtime',array("maxlength"=>"10","style"=>"width:80px",
               "onfocus"=>"endf()"));?>
               <script type="text/javascript">
               function startf(){
            	   var endtime=$dp.$('TechstackRegMaxtime');
            	   WdatePicker({onpicked:function(){
                	   	endtime.focus();
                	   },maxDate:'#F{$dp.$D(\'TechstackRegMaxtime\')}'
                   })
               }
               function endf(){
            	   WdatePicker({minDate:'#F{$dp.$D(\'TechstackRegMintime\')}'})
               }
               </script>
               </div>
            </div>
        </div>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">注册资本<span class="captype">(万)</span>：</div>
                <div class="form_right_e_input left">
               	<?php echo $form->text('Techstack.reg_mincaptital',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","style"=>"ime-mode:disabled","onkeydown"=>"checkpricekeyup(this,event)"));?>	       
            	到
				<?php echo $form->text('Techstack.reg_maxcaptital',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","style"=>"ime-mode:disabled","onkeydown"=>"checkpricekeyup(this,event)"));?>
            	</div>
            </div>
        </div>
        <div class="line"></div>
        <?php  echo $form->hidden('TechPerson.id'); ?>
        <div class="details_item_line">
            <div class="details_item">
                <div class="form_left_title left">人员总数≥：</div>
                <div class="form_right_e_input left">
                <?php echo $form->text('TechPerson.total',array("placeholder"=>"0","style"=>"ime-mode:disabled","maxlength"=>"6",'onkeydown'=>'inputOnlyNum(event)','onkeypress'=>'checkIfNum(event)'));?>
                </div>
            </div>
        </div>
        <div class="details_item_line">
              <div class="details_item">
                <div class="form_left_title left">所占学历人数/比例：</div>
                <div class="form_right_e_input left">
                <?php echo $form->select('TechPerson.education',$education, null,null,null)?>≥
                <?php echo $form->text('TechPerson.ed_above',array("class"=>"price","placeholder"=>"请输入多少人","style"=>"ime-mode:disabled;","maxlength"=>"6",'onkeydown'=>'inputOnlyNum(event)','onkeypress'=>'checkIfNum(event)'));?>（或）≥
                <?php echo $form->text('TechPerson.ed_proportion',array("class"=>"price","placeholder"=>"请输入所占比例","style"=>"ime-mode:disabled;","maxlength"=>"3",'onkeydown'=>'inputOnlyNum(event)','onkeypress'=>'checkIfNum(event)'));?>                     
                </div>
                <div class="error_message" style="color:green">如：输入80，表示所占比例≥80%</div>
            </div>
        </div>
        <div class="line"></div>
        <?php  echo $form->hidden('TechEconomic.id'); ?>
        <div id="TechEconomic">
	        <div class="details_item_line">
	            <div class="details_item">
	                <div class="form_left_title left">经济指标：</div>
	                <div class="form_right_e_input left">
	                	<?php echo $form->select('TechEconomic.min_company_year',$yearstr, null, null,null);?>到
	                	<?php echo $form->select('TechEconomic.max_company_year',$yearstr, null, null,null);?>
	                </div>
	            </div>
	        </div>
	        <div class="details_item_line">	
	            <div class="details_item">
	            	<div class="form_left_title left">总收入<span class="captype">(元)</span>：</div>
		            <div class="form_right_e_input left">
		           		<?php echo $form->text('TechEconomic.min_general_income',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
						到
		           		<?php echo $form->text('TechEconomic.max_general_income',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
		            </div>
	            </div>
	            <div class="details_item">
	            	<div class="form_left_title left">净利润<span class="captype">(元)</span>：</div>
	            	<div class="form_right_e_input left">
		            	<?php echo $form->text('TechEconomic.min_net_profit',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
			           	到
		           		<?php echo $form->text('TechEconomic.max_net_profit',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
	            	</div>     	
	            </div>
	        </div>
	        <div class="details_item_line">		
	            <div class="details_item">
					<div class="form_left_title left">工业总产值<span class="captype">(元)</span>：</div>
					<div class="form_right_e_input left">
						<?php echo  $form->text('TechEconomic.min_prospect',array("class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
						 到
		           		<?php echo $form->text('TechEconomic.max_prospect',array("class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
	            	</div>  
				</div>
				<div class="details_item">
					<div class="form_left_title left">产品销售额<span class="captype">(元)</span>：</div>
					<div class="form_right_e_input left">
						<?php echo $form->text('TechEconomic.min_gross_output',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
		             	到
		           		<?php echo $form->text('TechEconomic.max_gross_output',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
	            	</div>  
				</div>
	        </div>
			<div class="details_item_line">
				<div class="details_item">
					<div class="form_left_title left">利税<span class="captype">(元)</span>：</div>
					<div class="form_right_e_input left">
						<?php echo $form->text('TechEconomic.min_pro_taxe',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
					 	到
		           		<?php echo $form->text('TechEconomic.max_pro_taxe',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
	            	</div>  
				</div>
				<div class="details_item">
					<div class="form_left_title left">上缴税金<span class="captype">(元)</span>：</div>
					<div class="form_right_e_input left">
						<?php echo $form->text('TechEconomic.min_over_taxes',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
					 	到
		           		<?php echo $form->text('TechEconomic.max_over_taxes',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
	            	</div>  
				</div>
			</div>
			<div class="details_item_line">
				<div class="details_item">
					<div class="form_left_title left">出口创汇<span class="captype">(元)</span>：</div>
					<div class="form_right_e_input left">
						<?php echo $form->text('TechEconomic.min_qcll',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
						 到
		           		<?php echo $form->text('TechEconomic.max_qcll',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
	            	</div>  
				</div>
				<div class="details_item">
					<div class="form_left_title left">减免税指标<span class="captype">(元)</span>：</div>
					<div class="form_right_e_input left">
						<?php echo $form->text('TechEconomic.min_taxindex',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
					 	到
		           		<?php echo $form->text('TechEconomic.max_taxindex',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
	            	</div>  
				</div>
			</div>
			<div class="details_item_line">
				<div class="details_item">
					<div class="form_left_title left">高企减免税<span class="captype">(元)</span>：</div>
					<div class="form_right_e_input left">
						<?php echo $form->text('TechEconomic.min_tax',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
						 到
		           		<?php echo $form->text('TechEconomic.max_tax',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
	            	</div>  
				</div>
				<div class="details_item">
					<div class="form_left_title left">研发费减免税<span class="captype">(元)</span>：</div>
					<div class="form_right_e_input left">
						<?php echo $form->text('TechEconomic.min_devtax',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
					 	到
		           		<?php echo $form->text('TechEconomic.max_devtax',array("maxlength"=>"10","class"=>"price","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)"));?>
	            	</div>  
				</div>
			</div>
		</div>
		<div class="line"></div>
		<?php  echo $form->hidden('TechPatent.id'); ?>
        <div class="details_item_line">
              <div class="details_item">
                <div class="form_left_title left">知识产权指标：</div>
                <div class="form_right_e_input left">
                <?php echo $form->select('TechPatent.type_id',$patenttype, null,null,null)?>≥
                <?php echo $form->text('TechPatent.type_above',array("class"=>"price","placeholder"=>"请输入多少个","style"=>"ime-mode:disabled;","maxlength"=>"6",'onkeydown'=>'inputOnlyNum(event)','onkeypress'=>'checkIfNum(event)'));?>                  
                </div>
             </div>
        </div>
        <div class="line"></div>
        <?php  echo $form->hidden('TechDevelopmentCost.id'); ?>
        <div id="TechDevelopmentCost">
			<div class="details_item_line">
				<div class="details_item">
				    <div class="form_left_title left">研发费用投入：</div>
				    <div class="form_right_e_input form_date_picker left">
				    <?php  echo $form->select('TechDevelopmentCost.min_c_time',$yearstr, null, null,null);?>到
	                <?php echo $form->select('TechDevelopmentCost.max_c_time',$yearstr, null, null,null);?>
				    </div>
				</div>
				<div class="details_item">
				    <div class="form_left_title left">投入总额<span class="captype">(元)</span>：</div>
				    <div class="form_right_e_input left">
				    <?php echo $form->text('TechDevelopmentCost.min_cost',array("maxlength"=>"10","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)","class"=>"price"));?>
				          到
				     <?php echo $form->text('TechDevelopmentCost.max_cost',array("maxlength"=>"10","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)","class"=>"price"));?>
				        </div>
				</div>
			</div>
			<div class="details_item_line">
				<div class="details_item">
				    <div class="form_left_title left">研究与实验<span class="captype">(元)</span>：</div>
				    <div class="form_right_e_input left">
				    <?php echo $form->text('TechDevelopmentCost.min_research_exp',array("maxlength"=>"10","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)","class"=>"price"));?> 
				          到
				    <?php echo $form->text('TechDevelopmentCost.max_research_exp',array("maxlength"=>"10","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)","class"=>"price"));?>
				         </div>	    
				</div>
				<div class="details_item">
				    <div class="form_left_title left">新产品费用<span class="captype">(元)</span>：</div>
				    <div class="form_right_e_input left">
				    <?php echo $form->text('TechDevelopmentCost.min_new_product',array("maxlength"=>"10","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)","class"=>"price"));?> 
				       到
				     <?php echo $form->text('TechDevelopmentCost.max_new_product',array("maxlength"=>"10","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)","class"=>"price"));?>
				        </div> 
				</div>
			</div>
			<div class="details_item_line">
				<div class="details_item">
				    <div class="form_left_title left">政府拨款<span class="captype">(元)</span>：</div>
				    <div class="form_right_e_input left">
				    <?php echo $form->text('TechDevelopmentCost.min_govern_funding',array("maxlength"=>"10","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)","class"=>"price"));?>
				        到
				     <?php echo $form->text('TechDevelopmentCost.max_govern_funding',array("maxlength"=>"10","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)","class"=>"price"));?>
				        </div>	    
				</div>
				<div class="details_item">
				    <div class="form_left_title left">企业自筹费用<span class="captype">(元)</span>：</div>
				    <div class="form_right_e_input left">
				    <?php echo $form->text('TechDevelopmentCost.min_raised_enterprise',array("maxlength"=>"10","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)","class"=>"price"));?> 
				        到
				   <?php echo $form->text('TechDevelopmentCost.max_raised_enterprise',array("maxlength"=>"10","placeholder"=>"0.00","onkeydown"=>"checkpricekeyup(this,event)","class"=>"price"));?>
				   </div>    
				</div>
			</div>
		</div>
		<div class="line"></div>
        <div class="details_item_line">
            <div class="details_item">
            	<div class="form_left_title left"></div>
                <div class="form_add_submit left">
	                <?php echo $form->submit(__('Save',true), array("div"=>false)) ?>
	                <?php  echo $form->hidden('Techstack.id'); ?>
	                <?php  echo $form->hidden('Techstack.type',array('value'=>$filtertype)); ?>
                </div>
            </div>
        </div>
        </form>
    </div>
</div>
<script>
var webpath=$("#getpath").attr('href');
$(document).ready(function() {
	$(".form_left_title").css("width","135px");
	$(".price").css("width","98px");
	$("div.selector").css("width","103px");
	$("div.selector span").css("width","73px");
	$("div.selector select").css("min-width","108px");
	$("#uniform-TechstackDepartCharge.selector").css("width","150px");
	$("#uniform-TechstackDepartCharge.selector span").css("width","120px");
	$("#uniform-TechstackDepartCharge.selector select").css("min-width","156px");
	$("#TechstackName").keyup(function() {    		
		var pname=this.value;
		if(pname.trim()!=""){
   			var pnames=$("#pname").html();
   			if(pnames!=pname){
	   			var urlpath=webpath+'searchs/checktechname/'+encodeURIComponent(pname);
				$.ajax({     	   
			        url: urlpath, 
			        success:function(data){
			        	if(data=="1")
			        	{
			        		$("#namemessage").css('display','block');
			        		$("#namemessage").html('名称已存在');
			        	}else{
			        		$("#namemessage").css('display','none');
			        	}
			        }
			    });
		    }else{
		    	$("#namemessage").css('display','none');
		    }
	    }
    });
});
//范围
//验证范围
var checkflag=0;
function checkarea(r,l,str){
	var rtxt=$(r).val();
	var ltxt=$(l).val();
	if(rtxt!="" && ltxt!=""){
		if(parseFloat(rtxt)>parseFloat(ltxt)){
			showmessage(str+"范围必须从小到大输入！","F");
	    	$(l).focus();
	    	checkflag=1;
		}
	}
}
var arry=new Array();
arry[0]=Array("#TechstackRegMincaptital","#TechstackRegMaxcaptital","注册资本");
arry[1]=Array("#TechstackRegMinsize","#TechstackRegMaxsize","孵化面积");
arry[2]=Array("#TechEconomicMinCompanyYear","#TechEconomicMaxCompanyYear","经济指标年份");
arry[3]=Array("#TechEconomicMinGeneralIncome","#TechEconomicMaxGeneralIncome","总收入");
arry[4]=Array("#TechEconomicMinNetProfit","#TechEconomicMaxNetProfit","净利润");
arry[5]=Array("#TechEconomicMinProspect","#TechEconomicMaxProspect","工业总产值");
arry[6]=Array("#TechEconomicMinGrossOutput","#TechEconomicMaxGrossOutput","产品销售额");
arry[7]=Array("#TechEconomicMinProTaxe","#TechEconomicMaxProTaxe","利税");
arry[8]=Array("#TechEconomicMinOverTaxes","#TechEconomicMaxOverTaxes","上缴税金");
arry[9]=Array("#TechEconomicMinQcll","#TechEconomicMaxQcll","出口创汇");
arry[10]=Array("#TechEconomicMinTaxindex","#TechEconomicMaxTaxindex","减免税指标");
arry[11]=Array("#TechEconomicMinTax","#TechEconomicMaxTax","高企减免税");
arry[12]=Array("#TechEconomicMinDevtax","#TechEconomicMaxDevtax","研发费减免税");
arry[13]=Array("#TechDevelopmentCostMinCTime","#TechDevelopmentCostMaxCTime","研发费用投入年份");
arry[14]=Array("#TechDevelopmentCostMinCost","#TechDevelopmentCostMaxCost","投入总额");
arry[15]=Array("#TechDevelopmentCostMinResearchExp","#TechDevelopmentCostMaxResearchExp","研究与实验");
arry[16]=Array("#TechDevelopmentCostMinNewProduct","#TechDevelopmentCostMaxNewProduct","新产品费用");
arry[17]=Array("#TechDevelopmentCostMinGovernFunding","#TechDevelopmentCostMaxGovernFunding","政府拨款");
arry[18]=Array("#TechDevelopmentCostMinRaisedEnterprise","#TechDevelopmentCostMaxRaisedEnterprise","企业自筹费用");
var minstr="";
var maxstr="";
var strs="";
for(var index in arry){
	
	var minstr=arry[index][0];
    var maxstr=arry[index][1];
    var strs=arry[index][2];
    
	$(minstr).change(function(minstr,maxstr,strs) {
        return function () {
            checkarea(minstr,maxstr,strs);
        };
    }(minstr,maxstr,strs));
	
	$(maxstr).change(function(minstr,maxstr,strs) {
        return function () {
            checkarea(minstr,maxstr,strs);
        };
    }(minstr,maxstr,strs));
}
function checksave()
{
	if($("#namemessage").css('display')=="block"){
		$("#TechstackName").focus();
		return false;
	}
	if($("#TechstackName").val().trim() == ''){
		$("#TechstackName").focus();
		showmessage("请输入名称","F");
		return false;
	}else{
		$("#namemessage").css('display','none');
	}
	if($("#TechPersonEducation").val().trim() == '' && ($("#TechPersonEdAbove").val().trim() != '' || $("#TechPersonEdProportion").val().trim() != '')){
		$("#TechPersonEducation").focus();
		showmessage("请选择人员学历","F");
		return false;
	}
	if($("#TechPersonEducation").val().trim() != '' && $("#TechPersonEdAbove").val().trim() == '' && $("#TechPersonEdProportion").val().trim() == ''){
		$("#TechPersonEdAbove").focus();
		showmessage("请填写学历以上多少人或所占比例多少","F");
		return false;
	}
	if($("#TechPersonEdAbove").val().trim() != '' && $("#TechPersonEdProportion").val().trim() != ''){
		$("#TechPersonEdAbove").focus();
		showmessage("学历以上多少人或所占比例多少，只能选择一个填写。","F");
		return false;
	}
	var economic=0;
	$("#TechEconomic input").each(function(){
	    if($(this).val()!=""){
	    	economic=1;
	    	return;
		}
	});
	if(($("#TechEconomicMinCompanyYear").val().trim() != '' || $("#TechEconomicMinCompanyYear").val().trim() != '') && economic==0){
		$("#TechEconomicMinGeneralIncome").focus();
		showmessage("请输入经济指标中金额的筛选条件","F");
		return false;
	}
	if($("#TechEconomicMinCompanyYear").val().trim() == '' && $("#TechEconomicMinCompanyYear").val().trim() == '' && economic==1){
		$("#TechEconomicMinCompanyYear").focus();
		showmessage("请输入经济指标中年份的筛选条件","F");
		return false;
	}
	if($("#TechPatentTypeId").val().trim() != '' && $("#TechPatentTypeAbove").val().trim() == ''){
		$("#TechPatentTypeAbove").focus();
		showmessage("请填写专利数量","F");
		return false;
	}
	if($("#TechPatentTypeId").val().trim() == '' && $("#TechPatentTypeAbove").val().trim() != ''){
		$("#TechPatentTypeId").focus();
		showmessage("请选择专利","F");
		return false;
	}
	var developmentcost=0;
	$("#TechDevelopmentCost input").each(function(){
	    if($(this).val()!=""){
	    	developmentcost=1;
	    	return;
		}
	});
	if(($("#TechDevelopmentCostMinCTime").val().trim() != '' || $("#TechDevelopmentCostMaxCTime").val().trim() != '') && developmentcost==0){
		$("#TechDevelopmentCostMinCost").focus();
		showmessage("请输入研发费用投入中金额的筛选条件","F");
		return false;
	}
	if($("#TechDevelopmentCostMinCTime").val().trim() == '' && $("#TechDevelopmentCostMaxCTime").val().trim() == '' && developmentcost==1){
		$("#TechDevelopmentCostMinCTime").focus();
		showmessage("请输入研发费用投入中年份的筛选条件","F");
		return false;
	}
	for(var i=0;i<arry.length;i++){
		checkarea(arry[i][0],arry[i][1],arry[i][2]);
	}
	if(checkflag){
		checkflag=0;
		return false;
	}
	return true;
}
</script>